import React, { Component } from 'react'
import { withRouter } from 'react-router-dom'

class Detail extends Component {
  state = { proname : ''}
  componentDidMount () {
    fetch('http://121.89.205.189/api/pro/detail/' + this.props.match.params.proid)
    .then(res => res.json())
    .then(res => {
      this.setState({
        proname: res.data.proname
      })
    })
  }
  render() {
    console.log('detail render', this.props)
    return (
      <div className="box">
        <header className="header">detail header</header>
        <div className="content">
          { this.props.match.params.proid } - { this.state.proname }
        </div>
      </div>
    )
  }
}
export default withRouter(Detail)